package net.scribblemedia.candle.util;

import org.joda.time.DateMidnight;
import org.joda.time.Duration;

public class ScribbleRandomUtils {
	public static int randomIntegerBetween(int min, int max) {
		return (int) randomDoubleBetween((double) min, (double) max);
	}

	public static double randomDoubleBetween(double min, double max) {
		return min + (Math.random() * ((max - min) + 1));
	}
	
	public static DateMidnight randomDateMidnightBetween(DateMidnight startDate, DateMidnight endDate) {
		Duration duration = new Duration(startDate, endDate);
		long days = duration.getStandardDays();
		int numberOfDaysToAdd = randomIntegerBetween(0, (int) days);
		return startDate.plusDays(numberOfDaysToAdd);
	}
}
